package com.cq.hd.product.api;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.product.api.dto.*;
import com.cq.hd.product.api.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient(value = "hd-o2o-product-service", contextId = "active-api")
public interface TbActiveApi {

    // 校验活动商品库存
    @PostMapping("/product/active/checkGoodsStock")
    Result<Object> checkGoodsStock(@RequestBody ActiveGoodsStockCheckDto activeGoodsStockCheckDto);

    // 发布活动
    @PostMapping("/product/active/releaseActive")
    Result<Object> releaseActive(@RequestBody ActiveReleaseDto activeReleaseDto);

    // 发布拼团活动
    @PostMapping("/product/active/releaseGroupBuyActive")
    Result<Object> releaseGroupBuyActive(@RequestBody GroupBuyActiveReleaseDto activeReleaseDto);

    // 我的活动列表
    @GetMapping("/product/active/pageMyActive")
    Result<Page<AppMyActivePageVo>> pageMyActive(@SpringQueryMap AppMyActivePageDto appMyActivePageDto);

    // 修改活动
    @PostMapping("/product/active/updateActive")
    Result<Object> updateActive(@RequestBody ActiveUpdateDto activeUpdateDto);

    // 我的活动详情
    @GetMapping("/product/active/myActiveDetails")
    Result<AppMyActiveDetailsVo> myActiveDetails(@RequestParam("id") Long id);

    // 删除活动
    @DeleteMapping("/product/active/deleteActive")
    Result<Object> deleteActive(@RequestParam("id") Long id, @RequestParam("userId") Long userId, @RequestParam("businessId") Long businessId);

    @PostMapping("/product/active/down")
    Result<Object> takeDownActive(@RequestParam("id") Long id, @RequestParam("userId") Long userId, @RequestParam("businessId") Long businessId);

    // 查订单

    // 首页活动列表
    @PostMapping("/product/active/pageIndexActive")
    Result<Page<IndexActivePageVo>> pageIndexActive(@RequestBody IndexActivePageDto indexActivePageDto);

    // 活动详情
    @GetMapping("/product/active/details")
    Result<ActiveDetailsVo> details(@RequestParam("id") Long id, @RequestParam("userId") Long userId, @RequestParam("shareCode") String shareCode);

    // 活动可用红包列表
    @GetMapping("/product/active/availableRedPacketList")
    Result<List<ActiveRedPacketBilListVo>> availableRedPacketList(@RequestParam("id") Long id, @RequestParam("userId") Long userId);

    // 获取商品券的使用说明和可用商户
    @PostMapping("/product/active/useDetails")
    Result<ActiveGoodsUseDetailsVo> useDetails(@RequestBody GoodsUseDetailsDto goodsUseDetailsDto);

    // 后台活动列表
    @GetMapping("/product/active/pageAdminActive")
    Result<Page<AdminActivePageVo>> pageAdminActive(@SpringQueryMap AdminActivePageDto adminActivePageDto);

    // 后台活动详情
    @GetMapping("/product/active/adminDetails")
    Result<AdminActivePageVo> adminDetails(@RequestParam("id") Long id);

    // 后台活动删除
    @GetMapping("/product/active/adminDelete")
    Result<Void> adminDelete(@RequestParam("id") Long id);

    // 根据商家id查询活动总数
    @GetMapping("/product/active/countByBusinessId")
    Result<Integer> countByBusinessId(@RequestParam("businessId") Long businessId);

    // 商家主页活动列表
    @GetMapping("/product/active/pageHomeActive")
    Result<Page<BusinessHomeActivePageVo>> pageHomeActive(@SpringQueryMap BusinessHomeActivePageDto businessHomeActivePageDto);

    // 预分享活动
    @PostMapping("/product/active/preShareActive")
    Result<ActivePreShareVo> preShareActive(@RequestBody ActivePreShareDto activePreShareDto);

    // 分享活动
    @PostMapping("/product/active/shareActive")
    Result<ActiveShareVo> shareActive(@RequestBody ActiveShareDto activeShareDto);

    @PostMapping("/product/active/generateShortLink")
    Result<String> generateShortLink(@RequestBody ActiveShortLinkDto activeShortLinkDto);

    // 根据条件查询活动列表
    @PostMapping("/product/active/listByDto")
    Result<List<ActivePageVo>> listByDto(@RequestBody ActiveDto activeDto);

    // 根据活动id获取活动数据
    @GetMapping("/product/active/getById")
    Result<ActiveVo> getById(@RequestParam("id") Long id);

    // 根据活动id获取拼团活动设置
    @GetMapping("/product/active/getGroupBuyActiveByActiveId")
    Result<ActiveGroupBuyVo> getGroupBuyActiveByActiveId(@RequestParam("activeId") Long activeId);

    // 扣减活动库存和商品活动冻结库存
    @PostMapping("/product/active/subActiveStock")
    Result<Boolean> subActiveStock(@RequestBody ActiveSubStockDto activeSubStockDto);

    // 增加活动库存和商品活动冻结库存，将红包退还，设置为未使用状态
    @PostMapping("/product/active/addActiveStock")
    Result<Boolean> addActiveStock(@RequestBody ActiveAddStockDto activeAddStockDto);

    // 根据活动id获取简约活动数据
    @GetMapping("/product/active/getSimpleVoById")
    Result<ActiveSimpleVo> getSimpleVoById(@RequestParam("id") Long id);

    // 扫描活动结束时间，如果已结束，修改活动状态
    @PostMapping("/product/active/scanActiveJob")
    Result<Boolean> scanActiveJob();

    // 根据日期查询上新活动数
    @GetMapping("/product/active/getCountByDate")
    Result<Integer> getCountByDate(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    // 更新活动状态
    @PostMapping("/product/active/updateActiveState")
    Result<Boolean> updateActiveState(@RequestBody UpdateActiveStateDto updateActiveStateDto);

    // 查询已发布活动的城市，包含被删除的数据
    @GetMapping("/product/active/listCityName")
    Result<Set<String>> listCityName();

    // 商家进行中的活动
    @PostMapping("/product/active/listBusinessInProgressActives")
    Result<List<SearchBusinessActiveVo>> listBusinessInProgressActives(@RequestBody List<Long> businessIds);

}
